package com.xiaoy.core.side.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "test_sideType")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name="TEST_SIDETYPE_SEQ",sequenceName="TEST_SIDETYPE_SEQ",allocationSize=1)
public class SideType {
	private Long id;
	private List<Side> sides;
	private String name;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TEST_SIDETYPE_SEQ")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "sideType")
	@Fetch(FetchMode.SUBSELECT)
	public List<Side> getSides() {
		return sides;
	}

	public void setSides(List<Side> sides) {
		this.sides = sides;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
	
	
}
